<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>16_DOM2-高级浏览器-绑定方法2-解绑</title>

        <style>
            div {
                width: 100px;
                height: 100px;
                background-color: aqua;
            }
        </style>
    </head>
    <body>
        <div>绑定</div>

        <button>解绑</button>


        <script>
            var div = document.querySelector('div');

            function f1(){
                console.log(1111);
            }

            div.addEventListener('click',f1);

            // 解绑
            var btn = document.querySelector('button');
            btn.addEventListener('click',function(){
                div.removeEventListener('click',f1);
            })
        </script>
    </body>
</html>